package com.bw.medical.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bw.medical.vo.InquiryVos;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bw.common.utils.PageUtils;
import com.bw.common.utils.Query;

import com.bw.medical.dao.DockerLevelDao;
import com.bw.medical.entity.DockerLevelEntity;
import com.bw.medical.service.DockerLevelService;


@Service("dockerLevelService")
public class DockerLevelServiceImpl extends ServiceImpl<DockerLevelDao, DockerLevelEntity> implements DockerLevelService {

    @Autowired
    private DockerLevelDao dockerLevelDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<DockerLevelEntity> page = this.page(
                new Query<DockerLevelEntity>().getPage(params),
                new QueryWrapper<DockerLevelEntity>()
        );
        return new PageUtils(page);
    }
    //医生列表
    @Override
    public IPage<DockerLevelEntity> getLists(Map<String, Object> params) {
        Page<DockerLevelEntity> page = new Page<>(Integer.valueOf(params.get("page").toString()), Integer.valueOf(params.get("limit").toString()));
        return baseMapper.getLists(page,(String)params.get("docterName"),Integer.valueOf(params.get("departmentType").toString()));
    }
    //医生等级列表
    @Override
    public List<DockerLevelEntity> info(Integer departmentId) {
        List<DockerLevelEntity> info = dockerLevelDao.info(departmentId);
        return info;
    }
    //医生登录
    @Override
    public DockerLevelEntity login(String docterTell, String docterPwd) {
        DockerLevelEntity tbDockerLevelEntity = dockerLevelDao.selectOne(new QueryWrapper<DockerLevelEntity>()
                .eq("docter_tell", docterTell)
                .eq("docter_pwd", docterPwd));
        return tbDockerLevelEntity;
    }

    @Override
    public List<InquiryVos> doclist(String labels) {
        return baseMapper.doclist(labels);
    }
}